package com.example.myDesignPatterns.结构型模式.装饰者模式Decorator;

import java.sql.SQLOutput;

public class Client {
    public static void main(String[] args) {
        // 创建基本的炒饭对象
        FastFood food = new FriedRice();

        System.out.println(food.getDesc() + " 单价 " + food.calculateCost() + "元");

        food = new OnlyFried(food,8);
        System.out.println(food.getDesc() + " 利润 " + food.calculateCost() + "元");

        // 添加鸡蛋装饰器
        food = new Egg(food);
        System.out.println(food.getDesc() + " 单价 " + food.calculateCost() + "元");

        food = new GarnishAndFried(food,0.6f,8);
        System.out.println(food.getDesc() + " 利润 " + food.calculateCost() + "元");

        food = new Bacon(food);
        System.out.println(food.getDesc() + " 单价 " + food.calculateCost() + "元");

        food = new GarnishAndFried(food,0.6f,8,1f);
        System.out.println(food.getDesc() + " 利润 " + food.calculateCost() + "元");

        System.out.println("=======================");
        // 创建基本的炒面对象

        FastFood food2 = new FriedNoodles();
        System.out.println(food2.getDesc() + " 单价 " + food2.calculateCost() + "元");

        food2 = new Egg(food2);
        System.out.println( food2.getDesc() + " 单价 " + food2.calculateCost() + "元"
        );
        // 添加培根装饰器
        food2 = new Bacon(food2);
        System.out.println(food2.getDesc() + " 单价 " + food2.calculateCost() + "元");

        food2 = new GarnishAndFried(food2, 0.6f, 10, 1f);
        System.out.println(food2.getDesc() + " 利润 " + food2.calculateCost() + "元");
        // 添加利润装饰器
//        food2 = new GarnishAndFried(food2, food2.calculateCost(), 9, 1f); // 假设炒面成本9元，培根成本1元


        // 输出最终价格和描述
//        System.out.println(food2.getDesc() + " 单价 " + food2.calculateCost() + "元");
        }
}
